<template>
  <view class="content">
    <HxList
      :heightes="80"
      :times="200"
      :list="list"
      @clickTest="clickTest"
      v-if="list.length > 0"
    />
  </view>
</template>

<script>
import HxList from "@/common/components/school-list/huangxin-HxList.vue";
export default {
  components: {
    HxList,
  },
  data() {
    return {
      list: [
        // { Name: "北京" },
        // { Name: "上海" },
        // { Name: "深圳" },
        // { Name: "重庆" },
        // { Name: "成都" },
        // { Name: "天津" },
        // { Name: "四川" },
        // { Name: "湖南" },
        // { Name: "湖北" },
        // { Name: "河南" },
        // { Name: "黑龙江" },
        // { Name: "浙江" },
        // { Name: "NO.1" },
        // { Name: "China" },
        // { Name: "中国" },
      ],
      //全部学校list
      schoolList: [],
    };
  },
  onReady() {
    this.chooseSchool();
  },
  methods: {
    /**
     * 获取学校信息
     */
    chooseSchool() {
      this.$u.api.schoolsListUApi().then((res) => {
        this.schoolList = res;
        res.map((v) => {
          this.list.push({
            Name: v.title,
          });
        });
      });
    },
    clickTest(e) {
      this.schoolList.map((v) => {
        if (e.Name === v.title) {
          this.$u.vuex("vuex_school", v);
          uni.navigateBack({
            delta: 1,
          });
        }
      });
    },
  },
};
</script>

<style>
.content {
  width: 100%;
}
</style>
